<?php
session_start();

/*
 * Finds the number of carousels in the database
 *
 * Returns JSON respond with number
 *
 */

// Return json encoded data
header ('Content-type: application/json');

require_once '../core/db.php';

$sql = "SELECT COUNT(*) as num FROM siteElement WHERE isCarousel=:bool";
$query = $db -> prepare($sql);
$query -> bindParam(':bool', 1);
$query -> execute();
$res = $query -> fetch();
die(json_encode(array("respond" => $res['num'])));